/*
 * This class contains two buttons that will allow an admin user to choose whether they would 
 * like to search the geolocSearchScreen or the ReportSelectionActivity 
 */

package com.fourGirlsAndADude.mobileDRT;

import android.os.Bundle;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class AdminMenuActivity extends Activity {
	//Used to establish the UI
	Button reportSelectionButton;
	Button glcSearchButton;
	
	//Used to hold values found in the intent
	private String authorizationType;
	private String token;
	private String user;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_admin_menu);

		//Used to store values found in the intent
		authorizationType = this.getIntent().getStringExtra("AUTHORIZATION_TYPE");
		token = this.getIntent().getStringExtra("SESSION_TOKEN");
		user = this.getIntent().getStringExtra("USER_NAME");
		Log.v("TOKEN CHECK 1", "Token: "+ token);
		
		//Creates the buttons in the view
		reportSelectionButton = (Button) findViewById(R.id.reportSelectionButton);
		glcSearchButton = (Button) findViewById(R.id.glcSearchScreenButton);
		
		//On click launch Report Selection Activity
		reportSelectionButton.setOnClickListener(new Button.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//Create new intent and pass needed info to next activity
				Intent i = new Intent();
				i.setClassName("com.fourGirlsAndADude.mobileDRT",
						"com.fourGirlsAndADude.mobileDRT.ReportSelectionActivity");
				i.putExtra("AUTHORIZATION_TYPE",authorizationType);
				i.putExtra("SESSION_TOKEN", token);
				i.putExtra("USER_NAME", user);
				//Launch report Selection Activity
				startActivity(i);
				
			}
		});
		
		//On click launch GLC Search Selection Activity
		glcSearchButton.setOnClickListener(new Button.OnClickListener() {
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//Create new intent and pass needed info to next activity
				Intent i = new Intent();
				i.setClassName("com.fourGirlsAndADude.mobileDRT",
						"com.fourGirlsAndADude.mobileDRT.GeolocSearchActivity");
				i.putExtra("AUTHORIZATION_TYPE",authorizationType);
				i.putExtra("TOKEN_ID", token);
				i.putExtra("USER_NAME", user);
				//Launch GLC Search Activity
				startActivity(i);
				
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.admin_menu, menu);
		return true;
	}

}
